﻿je_the_forming_of_the_potchefstroom_winburg_republic = {
	icon = "gfx/interface/icons/event_icons/event_scales.dds"


	complete = {
		#exist = PTF
	}
	is_shown_when_inactive = {
		#THIS = c:ORA
	}
	possible = {
		#THIS = c:ORA
	}
	on_complete = {
		trigger_event = {
			id = south_america.1
		}
	}
	should_be_pinned_by_default = yes
}
je_encourage_boer_migration_into_the_oranje_river_basin = {
	icon = "gfx/interface/icons/event_icons/event_scales.dds"


	complete = {
			OR = {
				gdp > 200000
				year > 1952
			}
	}
	is_shown_when_inactive = {
		exists = c:WIN
		THIS = c:WIN
		NOT = {
			owns_entire_state_region = STATE_VRYSTAAT
		}
	}
	possible = {
		exists = c:WIN
		THIS = c:WIN
		NOT = {
			owns_entire_state_region = STATE_VRYSTAAT
		}
	}
	on_complete = {
		custom_tooltip = {
			text = form_oranje_vrystaat_2_tt
		}
		s:STATE_VRYSTAAT.region_state:BST = { set_state_owner = c:ORA }
	}
}
je_the_forming_of_the_oranje_vrystaat = {
	icon = "gfx/interface/icons/event_icons/event_scales.dds"


	complete = {
			gdp > 200000
			owns_entire_state_region = STATE_VRYSTAAT
	}
	on_complete = {
		remove_modifier = adjunct_volksraad
		change_tag = ORA
		set_global_variable = ora_exists
	}

	invalid = {
		exists = c:ORA
	}

	on_invalid = {
		set_global_variable = ora_exists
		remove_modifier = adjunct_volksraad
	}

	should_be_pinned_by_default = yes
}
je_climax_of_the_great_trek = {
	icon = "gfx/interface/icons/event_icons/event_scales.dds"


	complete = {
			OR = {
				gdp > 200000
				owns_entire_state_region = STATE_TRANSVAAL
			}
	}
	on_complete = {
		if={
			limit = {
				NOT = { owns_entire_state_region = STATE_TRANSVAAL }
			}
			s:STATE_TRANSVAAL.region_state:MTB = { set_state_owner = c:ZOU }
		}
		
		change_tag = TRN
		remove_modifier = adjunct_volksraad
		set_global_variable = trn_exists
	}

	
	invalid = {
		exists = c:TRN
	}

	on_invalid = {
		set_global_variable = trn_exists
		remove_modifier = adjunct_volksraad
	}

	should_be_pinned_by_default = yes
}
je_form_griqualand_west = {
	icon = "gfx/interface/icons/event_icons/event_centralization.dds"


	complete = {
		OR = {
			AND = {	
				gdp > 1200000
				exists = c:WBL
				root = {
					c:WBL.relations:ROOT > relations_threshold:amicable
				}
			}	

		}
	}
	on_complete = {
		c:WBL = {
			trigger_event = { id = journal_flavor_south_africa.11 }
		}
	}

	invalid = {
		OR = {
			c:WBL ?= {
				is_subject = yes
			}
			NOT = {
				exists = c:WBL
			}
		}
	}
}
je_anglo_zulu_war = {
	icon = "gfx/interface/icons/event_icons/event_military.dds"


	complete = {
		OR = {
			AND = {	
				gdp > 1200000
				root = {
					c:ZUL.relations:ROOT < relations_threshold:cold
				}
			}	
				year > 1879
		}
	}
	on_complete = {
		root = {
			create_diplomatic_play = {
				name = anglo_zulu_war
			
				target_state = s:STATE_ZULULAND.region_state:ZUL
				
				war = yes
				
				type = dp_annex_war
			}
		}
	}
}
je_establish_the_orange_river_soverignty = {
	icon = "gfx/interface/icons/event_icons/event_scales.dds"


	complete = {
		OR = {
			AND = {	
				gdp > 900000
				year > 1848
				root = {
					c:ORA.relations:ROOT > relations_threshold:cordial
				}
			}	
			AND = {
				year > 1854
				root = {
					is_ai = yes
				}
				c:ORA = {
					is_ai = yes
				}
			}
		}
	}
	on_complete = {
		root = {
			create_diplomatic_pact = {
				country = c:ORA
				type = puppet
			}	
		}
	}
}
je_establish_the_traansval_colony = {
	icon = "gfx/interface/icons/event_icons/event_scales.dds"


	complete = {
		OR = {
			AND = {	
				gdp > 1400000
				year > 1860
				root = {
					c:TRN.relations:ROOT < relations_threshold:cordial
				}
			}	
			AND = {
				year > 1874
				root = {
					is_ai = yes
				}
				c:TRN = {
					is_ai = yes
				}
			}
		}
	}
	#is_shown_when_inactive = {
	#	THIS = c:SAF
	#}
	#possible = {
	#	THIS = c:SAF
	#}
	on_complete = {
		IF = {
			limit = {
				c:TRN ?= {
					is_ai = yes
				}
			}
			root = {
				create_diplomatic_pact = {
					country = c:TRN
					type = puppet
				}	
			}
		}
		IF = {
			limit = {
				c:TRN ?= {
					is_ai = no
				}
			}
			create_diplomatic_play = {
				name = Anglo_intervention_in_Transvaal
				target_country = c:TRN
				war = yes
				type = dp_make_puppet
			}
		}

	}
}
je_first_boer_war = {
	icon = "gfx/interface/icons/event_icons/event_scales.dds"


	complete = {
		OR = {
			AND = {	
				year > 1860
				root = {
					c:TRN.relations:ROOT < relations_threshold:cordial
				}
			}	
			AND = {
				year > 1880
				c:ORA ?= {
					is_ai = yes
				}
				c:TRN ?= {
					is_ai = yes
				}
			}
		}
	}
	is_shown_when_inactive = {
		OR = {
			AND = {
				exists = c:TRN
				THIS = c:TRN
			}

			AND = {
				exists = c:ORA
				THIS = c:ORA
			}
		}
	}
	possible = {
		AND = {
			exists = c:ORA
			c:ORA = {
				is_subject_of = root
			}
		}
		AND = {
			exists = c:TRN
			c:TRN = {
				is_subject_of = root
			}
		}
	}
	on_complete = {
		c:TRN = {
			make_independent = yes
		}
		c:ORA = {
			make_independent = yes
		}
		root = {
			create_diplomatic_play = {
				name = first_boer_war
				target_country = c:TRN
				war = yes
				type = dp_make_puppet
			}
			create_diplomatic_play = {
				name = first_boer_war
				target_country = c:ORA
				war = yes
				type = dp_make_puppet
			}
		}
	}
}
je_second_boer_war = {
	icon = "gfx/interface/icons/event_icons/event_scales.dds"


	complete = {
		OR = {
			AND = {	
				year > 1880
				root = {
					c:TRN.relations:ROOT < relations_threshold:cordial
				}
			}	
			AND = {
				year > 1899
				c:ORA ?= {
					is_ai = yes
				}
				c:TRN ?= {
					is_ai = yes
				}
			}
		}
	}
	is_shown_when_inactive = {
		OR = {
			AND = {
				exists = c:TRN
				THIS = c:TRN
			}

			AND = {
				exists = c:ORA
				THIS = c:ORA
			}
			
		}
	}
	possible = {
		year > 1880
		NOT = {
			c:ORA ?= {
				is_subject_of = root
			}
			c:TRN ?= {
				is_subject_of = root
			}
		}
	}
	on_complete = {
		c:TRN = {
			make_independent = yes
		}
		c:ORA = {
			make_independent = yes
		}
		root = {
			create_diplomatic_play = {
				name = first_boer_war
				target_country = c:TRN
				war = yes
				type = dp_make_puppet
			}
			create_diplomatic_play = {
				name = first_boer_war
				target_country = c:ORA
				war = yes
				type = dp_make_puppet
			}
		}
	}
}
je_form_the_union_of_south_africa = {
	icon = "gfx/interface/icons/event_icons/event_centralization.dds"


	complete = {
		custom_tooltip = {
			text = is_african_union_tt
			AND = {
				exists = c:BOE
				c:BOE = ROOT
			}

		}
	
	}
	on_complete = {

		if = {
			limit = { 
				is_subject_type = subject_type_puppet
			}
			top_overlord = {
				create_diplomatic_pact = {
					country = root
					type = dominion
				}
			}
		}
		add_modifier = {
			name = union_of_south_africa_modifier
		}
	}
	should_be_pinned_by_default = yes
}